#include <cstdio>
#include <map>

using namespace std;

int n, m;
long long k;
map<pair<int, int>, bool> mp;

int main( )
{
    int i, j, x0, y0;
    long long p, ans, pos;
    while ( scanf("%d%d%I64d", &n, &m, &k) != EOF )
    {
        mp.clear( );
        p = ( 1 + ( n + 1 ) / 2 ) * ( ( n + 1 ) / 2 ) / 2;
        for ( i = 0; i < m; i++ )
        {
            scanf("%d%d", &x0, &y0);
            if ( n % 2 == 1 && x0 == n / 2 + 1 && y0 == n / 2 + 1 )
            {
                if ( mp[ pair<int, int>( x0, y0 ) ] ) continue;
                p--;
                mp[ pair<int, int>( x0, y0 ) ] = 1;
            }
            if ( x0 == y0 ) 
            {
                if ( mp[ pair<int, int>( x0, y0 ) ] ) continue;
                p--;
                mp[ pair<int, int>( x0, y0 ) ] = mp[ pair<int, int>( n - 1 - x0, y0 ) ]
                    = mp[ pair<int, int>( x0, n - 1 - y0 ) ] = mp[ pair<int, int>( n - 1 - x0, n - 1 - y0 ) ] = 1;
                mp[ pair<int, int>( y0, x0 ) ] = mp[ pair<int, int>( n - 1 - y0, x0 ) ]
                    = mp[ pair<int, int>( y0, n - 1 - x0 ) ] = mp[ pair<int, int>( n - 1 - y0, n - 1 - x0 ) ] = 1;
            }
            else
            {
                if ( mp[ pair<int, int>( x0, y0 ) ] ) continue;
                if ( n % 2 == 1 && ( x0 == n / 2 + 1 || y0 == n / 2 + 1 ) )
                {
                    p--;
                    mp[ pair<int, int>( x0, y0 ) ] = mp[ pair<int, int>( n - 1 - x0, y0 ) ]
                        = mp[ pair<int, int>( x0, n - 1 - y0 ) ] = mp[ pair<int, int>( n - 1 - x0, n - 1 - y0 ) ] = 1;
                    mp[ pair<int, int>( y0, x0 ) ] = mp[ pair<int, int>( n - 1 - y0, x0 ) ]
                        = mp[ pair<int, int>( y0, n - 1 - x0 ) ] = mp[ pair<int, int>( n - 1 - y0, n - 1 - x0 ) ] = 1;
                }
                else
                {
                    p--;
                    mp[ pair<int, int>( x0, y0 ) ] = mp[ pair<int, int>( n - 1 - x0, y0 ) ]
                        = mp[ pair<int, int>( x0, n - 1 - y0 ) ] = mp[ pair<int, int>( n - 1 - x0, n - 1 - y0 ) ] = 1;
                    mp[ pair<int, int>( y0, x0 ) ] = mp[ pair<int, int>( n - 1 - y0, x0 ) ]
                        = mp[ pair<int, int>( y0, n - 1 - x0 ) ] = mp[ pair<int, int>( n - 1 - y0, n - 1 - x0 ) ] = 1;
                }
            }
        }
        pos = 1;
        while ( pos <= p ) pos <<= 1;
        pos >>= 1;
        ans = 1;
        while ( pos )
        {
            ans = ans * ans % 100000007;
            if ( pos & p ) ans = ans * k % 100000007;
            pos >>= 1;
        }
        printf("%I64d\n", ans);
    }
    return 0;
}
